package com.yanqu.road.server.pb;



import com.yanqu.road.entity.npc.UserNpcGangfen;
import com.yanqu.road.entity.npc.UserNpcTalk;
import com.yanqu.road.entity.npc.UserNpcTrade;
import com.yanqu.road.pb.npc.NpcEventProto;

public class NpcPb {

	//获取同步Npc对话协议
	public static NpcEventProto.NpcTalkEventMsg.Builder parseNpcTalkEventMsg(UserNpcTalk userNpcTalk){
		NpcEventProto.NpcTalkEventMsg.Builder msg = NpcEventProto.NpcTalkEventMsg.newBuilder();
		msg.setNo(userNpcTalk.getNo());
		msg.setEventId(userNpcTalk.getEventId());
		msg.setReward(userNpcTalk.getReward());
		msg.setRefreshTime((int)(userNpcTalk.getRefreshTime()/1000));
		msg.setIsGetReward(userNpcTalk.isGetReward());
		return msg;
	}

	//获取同步Npc贸易协议
	public static NpcEventProto.NpcTradeEventMsg.Builder parseNpcTradeEventMsg(UserNpcTrade userNpcTrade){
		NpcEventProto.NpcTradeEventMsg.Builder msg = NpcEventProto.NpcTradeEventMsg.newBuilder();
		msg.setNo(userNpcTrade.getNo());
		msg.setEventId(userNpcTrade.getEventId());
		msg.setConsume(userNpcTrade.getConsume());
		msg.setReward(userNpcTrade.getReward());
		msg.setRefreshTime((int)(userNpcTrade.getRefreshTime()/1000));
		msg.setStatus(userNpcTrade.getStatus());
		msg.setIsGetReward(userNpcTrade.isGetReward());
		return msg;
	}

	public static NpcEventProto.NpcGangFenEventMsg.Builder parseNpcGangfenEventMsg(UserNpcGangfen userNpcTrade){
		NpcEventProto.NpcGangFenEventMsg.Builder msg = NpcEventProto.NpcGangFenEventMsg.newBuilder();
		msg.setNo(userNpcTrade.getNo());
		msg.setEventId(userNpcTrade.getEventId());
		msg.setRefreshTime((int)(userNpcTrade.getRefreshTime()/1000));
		msg.setIsGetReward(userNpcTrade.isGetReward());
		return msg;
	}

}
